package com.twb.core.base.entity;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.baomidou.mybatisplus.annotation.Version;

/** 
 * @ClassName BaseVersionEntity 
 * @Description 基础实体类（乐观锁）
 * @author DSY
 * @date 2018年11月1日 下午2:18:53 
 */ 
public class BaseVersionEntity extends BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;
	
    /**
     * 数据版本号,每发生update则自增,用于实现乐观锁.
     */
    @Version
    protected Long version;

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }

    @Override
    public String toJSONString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
    

	public Long getVersion() {
        return version;
    }

    public void setVersion(Long version) {
        this.version = version;
    }

}
